{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Optimising the design of headphones\n", "## Problem definition\n", "You work on the R&D department of Banshee Ltd., a company that manufactures headphones. Through a customer survey you have determined that the level of satisfaction of your headphones is given by the following expression: \n", "\n", "$z = 5 + ln(x_1) + x_2^2 + x_1*x_2$\n", "\n", "where $x_1$ is the thickness of the diaphragm in microns and $x_2$ is the radius of the diaphragm in millimeters. Due to design constraints, the volume of the driver, which can be estimated as $0.2*\\pi*x_2*x_1$ cannot be larger than 0.172 cubic millimeters. The properties of the material you use makes it unfeasible to manufacture a diaphragm with a thickness lower than $0.3$ microns or higher than $0.9$ microns.\n", "\n", "**a** Write a Non-Linear Programming (NLP) problem to find the optimal design specifications (thickness and radius of diaphragm) for Banshee Ltd.\n", "\n", "The objective is to maximise the level of satisfaction given by the following expressions: \n", "\n", "$\\max z = 5 + ln(x_1) + x_2^2 + x_1*x_2$\n", "\n", "$\\text{s.t.}$\n", "\n", "$2*\\pi*x_2*x_1 \\leq 1.72$\n", "\n", "$x_1 \\geq 0.3$\n", "\n", "$x_1 \\leq 0.9$\n", "\n", "**b** Write down the Lagrangian and the Kuhn Tucker conditions \n", "\n", "The Lagrangian is:\n", "\n", "$\\text{L}(x_1, x_2, \\lambda_1, \\lambda_2, \\lambda_3) = 5 + ln(x_1) + x_2^2 + x_1*x_2 + \\lambda_1*(2*\\pi*x_2*x_1 -1.72) + \\lambda_2*(0.3 - x_1) + \\lambda_3*(x_1-0.9)$\n", "\n", "**Gradient condition**\n", "\n", "$\\nabla(\\text{L}(x_1, x_2, \\lambda_1, \\lambda_2, \\lambda_3)) = 0$\n", "\n", "$\\frac{\\delta\\text{L}}{\\delta x_1}=\\frac{1}{x_1}+x_2+2*\\pi*\\lambda_1*x_2-\\lambda_2 + \\lambda_3=0$\n", "\n", "$\\frac{\\delta\\text{L}}{\\delta x_2}=2*x_2+x_1+2*\\pi*\\lambda_1*x_1=0$\n", "\n", "**Feasibility condition**\n", "\n", "$2*\\pi*x_2*x_1 \\leq 1.72$\n", "\n", "$x_1 \\geq 0.3$\n", "\n", "$x_1 \\leq 0.9$\n", "\n", "**Orthogonality condition**\n", "\n", "$\\lambda_1*(2*\\pi*x_2*x_1 -1.72)=0$\n", "\n", "$\\lambda_2*(0.3 - x_1) = 0$\n", "\n", "$\\lambda_3*(x_1-0.9)=0$\n", "\n", "**Non-Negativity condition**\n", "\n", "Since we expressed the problem in the canonical form, we know that the multipliers must be non-negative:\n", "$x_1, x_2 \\geq 0$\n", "\n", "$\\lambda_1, \\lambda_2, \\lambda_3 \\leq 0$\n", "\n", "**c** A solver gives you the following solution ($x_1 = 0.9$,$x_2 = 0.304$). Determine if it is a local or global maximum \n", "\n", "First, we need to calculate the Lagrangian multipliers to make sure that the solution is feasible. \n", "\n", "We plug in the numbers provided by the solver in the second gradient condition and obtain: \n", "\n", "$\\lambda_1 = \\Large \\frac{-2*x_2 - x_1}{2*\\pi*x_1}=-0.267 \\leq 0$\n", "\n", "From the second orthogonality condition, we know that $\\lambda_2$ must be zero: \n", "\n", "$\\lambda_2*(0.3 - x_1) = \\lambda_2*(-0.6) = 0$\n", "\n", "$\\lambda_2 = 0$\n", "\n", "Now, we can plug in this value into the first gradient condition to compute $\\lambda_3$:\n", "\n", "$\\lambda_3 = -1/x_1 -x_2 -2*\\pi*\\lambda_1*x_2 = -0.906$\n", "\n", "Since all the multipliers are non-positive, the solution is feasible. The Hessian is given by: \n", "\n", "$H = \\begin{bmatrix}\n", "\\frac{-1}{x_1^2} & 1 \\\\\n", "1 & 2 \n", "\\end{bmatrix}$\n", "\n", "The determinants of the Hessian are: \n", "\n", "$h_1 = \\frac{-1}{x_1^2} \\leq 0 \\quad \\forall x_1 > 0$\n", "\n", "$h_2 = \\frac{-2}{x_1^2} -1 \\leq 0 \\quad \\forall x_1 > 0$\n", "\n", "Since $x_1$ is greater than zero, the solution is a global maximum.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }